package net.acoinWork.dynRender.configParse.propertyModel;

/**
 * @author xusk
 * @date: 16/1/4 下午4:33
 */
public abstract class PropertyModel implements PairDelivery<String, String> {

    protected abstract void basicAttribute(String key, String val);

    protected abstract void complexAttribute(String attrName, String nextParam, String val);

    @Override
    public void deliver(String key, String val) {
        String[] keyParts = key.split("\\.");
        if (keyParts.length == 1) {
            basicAttribute(key, val);
        } else {
            String nextParam = key.substring(key.indexOf(".") + 1);
            String attrName = key.substring(0, key.indexOf("."));
            complexAttribute(attrName, nextParam, val);
        }
    }
}
